package com.qunar.wan.util;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:spring/spring.xml" })
public class VelocityDemo {
    /**
     * 入门，标准velocity的使用
     */
    @Test
    public void main() {
        // Properties p = new Properties();
        // p.setProperty("resource.loader", "class");
        // p.setProperty("class.resource.loader.class",
        // "org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader");
        // // p.setProperty("resourceLoaderPath","/WEB-INF/vm/");
        // VelocityEngine ve = new VelocityEngine() ;
        // ve.init(p);
        // Template t = ve.getTemplate("/template/hello.vm", "UTF-8");
        // VelocityContext context = new VelocityContext();
        // context.put("name", "张三");
        // context.put("project", "Jakarta");
        // StringWriter writer = new StringWriter();
        // t.merge(context, writer);
        // System.out.println(writer.toString());
    }
}